<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <a href="#/login">登录</a>
    <a href="#/register">注册</a>
    <div id="app"></div>
</body>
<script>
    // 根据锚点来做判断
    var oDiv = document.getElementById('app')
    window.addEventListener('hashchange',function(){
        console.log(location.hash)
        switch (location.hash) {
            case '#/login':
                oDiv.innerHTML='登录'
                break;
            case '#/register':
                oDiv.innerHTML='注册'
                break;
        }
    })

</script>
</html>